package com.labreeze.spring.ioc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.labreeze.spring.pojo.Student;
import com.labreeze.spring.pojo.User;

public class TestApplicationContext {
	
	  public static void main( String[] args )
	    {
	       ApplicationContext ctx=new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
	       User user1=(User)ctx.getBean("user");
//	       user1.setUname("testName");
	       user1.setPassWord("testPasswWorkd");
	       
	       
	       //从此可以看书ctx刚刚开始的时候就初始化了User
	       Student stu=(Student)ctx.getBean("student");
		   System.out.println(stu.getUser().getUname());
	    }

}
